package com.zw.transition.services;

import com.zw.transition.entity.Log;
import com.zw.transition.mapper.LogMapper;
import com.zw.transition.util.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @Description:
 *
 * @Author: China.sgl
 * @Date: 2019/11/28 09:11
 */
@Service
@SuppressWarnings("all")
public class LogService {

    @Autowired
    private LogMapper logMapper;

    /**
     * 保存日志
     *
     * @param log 日志类
     * @return log
     */
    //public Log saveLog(Log log) {
    //    return logMapper.save(log);
    //}
    //
    ///**
    // * 保存日志
    // *
    // * @param title 操作名
    // * @param content 操作内容
    // * @return log
    // */
    //public Log saveLog(String title, String content) {
    //    User user = ShiroUtils.getUser();
    //    Log log = new Log();
    //    log.setAccount(user.getAccount());
    //    log.setOperator(user.getName());
    //    log.setTitle(title);
    //    log.setOperTime(new Date());
    //    log.setContent(content);
    //    log.setAddress(ShiroUtils.getIp());
    //    return saveLog(log);
    //}
    //
    ///**
    // * 保存日志
    // *
    // * @param title 操作名
    // * @param before 源对象
    // * @param after 目标对象
    // * @return log
    // */
    //public Log saveLog(String title, Object before, Object after) {
    //    return saveLog(title, BeanUtil.compare(before, after));
    //}

}
